package cn.leelei.hibernate.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * 邮箱和角色之间的关系  多对一
 * @author Nike
 *
 */
//添加注解实体类
@Entity
//添加注解表表名为User
@Table(name="Email")
public class Email {
	//映射主键
	@Id
	//主键的生成策略
	//自增长IDENTITY
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;//用户表的id 字段
	@Column(name="UserName")//普通列名
	private String UserName;//用户表的UserName 字段
	@Column(name="PassWord")//普通列名
	private String PassWord;//用户表的PassWord 字段
	@Column(name="Address")//普通列名
	private String Address;//用户表的Address 字段
	@Column(name="Email")//普通列名
	private String Email;//用户表的Email 字段
	
    @ManyToOne//多对一关系
	private Role role;//和角色之间的关系---》在数据库中会多一个外键
	
	
	
	
	public Role getRole() {
		return role;
	}
	public void setRole(Role role) {
		this.role = role;
	}
	public String getEmail() {
		return Email;
	}
	public void setEmail(String email) {
		Email = email;
	}
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getUserName() {
		return UserName;
	}
	public void setUserName(String userName) {
		UserName = userName;
	}
	public String getPassWord() {
		return PassWord;
	}
	public void setPassWord(String passWord) {
		PassWord = passWord;
	}
	public String getAddress() {
		return Address;
	}
	public void setAddress(String address) {
		Address = address;
	}
	
	
	public Email(Integer id, String userName, String passWord, String address, String email, Role role) {
		super();
		this.id = id;
		UserName = userName;
		PassWord = passWord;
		Address = address;
		Email = email;
		this.role = role;
	}
	public Email() {
		super();
		
	}
	
    
}
